/**
 * @filename:SynbdServiceImpl Dec 8, 2023
 * @project Wonder Vue Admin Api  1.1.0
 * Copyright(c) 2022 Wonder Co. Ltd. 
 * All right reserved. 
 */
package com.wonder.app.service.impl;

import com.wonder.app.domain.OtherIn;
import com.wonder.app.domain.Synbd;
import com.wonder.app.mapper.SynbdDao;
import com.wonder.app.service.SynbdService;
import com.wonder.app.request.SynbdRequest;
import com.wonder.common.utils.DateUtils;
import com.wonder.common.utils.StringUtils;
import com.wonder.common.utils.MessageUtils;
import com.wonder.common.common.AjaxResult;

import java.util.Date;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**   
 * @Description:TODO(基础资料同步服务实现)
 *
 * @version: 1.1.0
 * @author: Wonder
 * 
 */
@Service
public class SynbdServiceImpl  extends ServiceImpl<SynbdDao, Synbd> implements SynbdService  {

    /**
     * 验证基础资料同步信息
     * 
     * @param synbd
     * @param type
     * @return String
     */
    @Override
    public String validate(Synbd synbd,String type){
    
    
       return "";
    }
    
    
    /**
	 * Description:基础资料同步分页返回
	 * @param request //检索条件
	 * @param page //分页参数
	 * @return IPage<Synbd>   //分页记录
	 */
	@Override 
	public IPage<Synbd> selectList(SynbdRequest request, Page<Synbd> page){
	    LambdaQueryWrapper<Synbd> lambdaQueryWrapper = new LambdaQueryWrapper<>();
	    
	    if (null != request.getId()) {
	       lambdaQueryWrapper.eq(Synbd::getId, request.getId());
	      }               

	    if(null != request.getFtype()){
	    	lambdaQueryWrapper.like(Synbd::getFtype,request.getFtype());
		}
	    if (null != request.getReloadStartTime()){
			Date[] reloadStartTime = request.getReloadStartTime();
			if(reloadStartTime.length > 0)
				lambdaQueryWrapper.ge(Synbd::getReloadStartTime, reloadStartTime[0]);
			if(reloadStartTime.length == 2)
				lambdaQueryWrapper.le(Synbd::getReloadStartTime, DateUtils.dateToStr(reloadStartTime[1],"yyyy-MM-dd") + " 23:59:59");
		}
        
		lambdaQueryWrapper.orderByDesc(Synbd::getId);	
		Page<Synbd> selectPage = this.baseMapper.selectPage(page, lambdaQueryWrapper);

		return selectPage;
    }
        
    
	
}